using System;
using Unity.Entities;
using Unity.Mathematics;

namespace Game.Common.Definition
{
    public struct AttackTarget : IEquatable<AttackTarget>, IComparable<AttackTarget>
    {
        public Entity Entity;
        public float3 Position;
        
        public static bool operator==(AttackTarget lhs, AttackTarget rhs)
        {
            bool3 ret = lhs.Position == rhs.Position; 
            return lhs.Entity == rhs.Entity && ret.x && ret.y && ret.z;
        }
        
        public static bool operator!=(AttackTarget lhs, AttackTarget rhs)
        {
            return !(lhs == rhs);
        }
        
        public bool Equals(AttackTarget other)
        {
            return this == other;
        }

        public int CompareTo(AttackTarget other)
        {
            return Entity.CompareTo(other.Entity);
        }
    }
}